home *** CD-ROM | disk | FTP | other *** search
- Path: news.magg.net!news
- From: n4mwd@magg.net (Dennis Hawkins)
- Newsgroups: comp.lang.c,comp.lang.c++,comp.os.ms-windows.programmer.misc,comp.os.msdos.programmer,comp.programming,comp.windows.ms.programmer
- Subject: Re: Date Arithmetic
- Date: Thu, 22 Feb 1996 05:47:04 GMT
- Organization: M.A.G. Information Services (MAGG.NET)
- Message-ID: <4ggsj3$1fg@dopey.magg.net>
- References: <4g19kp$640@tracy.protocom.com> <jrs.2754.000A7444@dclf.npl.co.uk>
- NNTP-Posting-Host: wpb-133.magg.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- jrs@dclf.npl.co.uk (Dr John Stockton NPL UK) wrote:
-
- >In article <4g19kp$640@tracy.protocom.com> "Michael J. Karas" <mkaras@pclink.com> writes:
-
- >>I am working on an algorithm for a laser marking machine that writes
- >>expiration delays on to food product boxes. The algorithm needs to
- >>be able to add NNN days to todays date in the fastest manner possible
- >>without using any floating point arithmetic. I could use help from anyone
-
- This shouldn't be a big deal. There are several algorithims to handle
- this. The best one depends on the range of NNN days. If it is just a
- couple of weeks then add it by brute force to the month. If NNN can
- go to 999 then you are probably better off converting todays date into
- a julian or an integer that represents the number of days since your
- machine was put on line. Then just add the days like you would any
- other integer. Then convert it back again. Dates can be tricky, you
- just need to do a lot of testing to make sure they work ok though.
-
-
- Dennis Hawkins
- n4mwd@amsat.org
-
-